/**
 *
 */
package com.honeybees.framework.common.util.filetype;

/**
 * <dl>
 * <dt><b> 文件类型 </b></dt>
 * <p>
 * <dd>https://en.wikipedia.org/wiki/List_of_file_signatures</dd>
 * </dl>
 * <p>
 * Copyright (C) All rights reserved.
 * </p>
 *
 * @author 李远明
 * @since 2016-08-08 16:11:59
 */
public enum FileType {

    /**
     * IBM Storyboard bitmap file<br>
     * <p>
     * Windows
     * <a href="https://en.wikipedia.org/wiki/Program_information_file" title="Program information
     * file">Program Information File</a><br>
     * Mac <a href="https://en.wikipedia.org/wiki/StuffIt" title="StuffIt">Stuffit</a>
     * Self-Extracting Archive<br>
     * IRIS <a href="https://en.wikipedia.org/wiki/Optical_character_recognition" title="Optical
     * character recognition">OCR</a> data file
     * </p>
     */
    PIC("00", "PIC", "PIF", "SEA", "YTR"),

    /**
     * Computer icon encoded in ICO file format
     */
    ICO("00000100", "ico"),

    /**
     * 3rd Generation Partnership Project 3GPP and 3GPP2 multimedia files
     */
    _3GP("667479703367", "3gp", "3g2"),
    /**
     * 3rd Generation Partnership Project 3GPP and 3GPP2 multimedia files
     */
    _3G2("667479703367", "3gp", "3g2"),

    /**
     * compressed file (often tar zip) <br>
     * using Lempel-Ziv-Welch algorithm
     */
    TAR_Z1("1F9D", "z", "tar.z"),
    /**
     * Compressed file (often tar zip) <br>
     * using LZH algorithm
     */
    TAR_Z2("1FA0", "z", "tar.z"),

    /**
     * Compressed file using <a href="https://en.wikipedia.org/wiki/Bzip2" title="Bzip2">Bzip2</a>
     * algorithm
     */
    BZ2("425A68", "bz2"),

    /**
     * Image file encoded in the Graphics Interchange Format (GIF)：GIF87a
     */
    GIF1("474946383761", "gif"),
    /**
     * Image file encoded in the Graphics Interchange Format (GIF)：GIF89a
     */
    GIF2("474946383961", "gif"),

    /**
     * <a href="https://en.wikipedia.org/wiki/Tagged_Image_File_Format" title="Tagged Image File
     * Format">Tagged Image File Format: II*. (little endian format)</a>
     */
    TIFF1("49492A00", "tif", "tiff"),
    /**
     * <a href="https://en.wikipedia.org/wiki/Tagged_Image_File_Format" title="Tagged Image File
     * Format">Tagged Image File Format: MM.* (big endian format)</a>
     */
    TIFF2("4D4D002A", "tif", "tiff"),

    /**
     * SMPTE DPX image : SDPX
     */
    DPX1("53445058", "dpx"),
    /**
     * SMPTE DPX image : XPDS
     */
    DPX2("58504453", "dpx"),

    /**
     * JPEG raw or in the JFIF or Exif file format
     */
    JPEG("FFD8FFDB", "jpg", "jpeg"),
    /**
     * JPEG raw or in the JFIF or Exif file format
     */
    JPEG_JFIF("FFD8FFE000104A4649460001", "jpg", "jpeg"),
    /**
     * JPEG raw or in the JFIF or Exif file format
     */
    JPEG_Exif("FFD8FFE10018457869660000", "jpg", "jpeg"),

    /**
     * DOS MZ executable file format and its descendants (including NE and PE)
     */
    EXE("4D5A", "exe"),
    /**
     * Windows MSI
     */
    MSI("D0CF11E0A1B11AE1", "msi"),

    /**
     * zip file format and formats based on it, such as JAR, ODF, OOXML : empty archive
     */
    ZIP_EMPTY("504B0506", "zip", "jar", "odt", "ods", "odp", "docx", "xlsx", "pptx", "vsdx", "apk"),
    /**
     * zip file format and formats based on it, such as JAR, ODF, OOXML : spanned archiv
     */
    ZIP("504B0304", "zip", "jar", "odt", "ods", "odp", "docx", "xlsx", "pptx", "vsdx", "apk"),

    /**
     * RAR archive version 1.50 onwards
     */
    RAR1("526172211A0700", "rar"),
    /**
     * RAR archive version 5.0 onwards
     */
    RAR2("526172211A070100", "rar"),

    /**
     * Image encoded in the Portable Network Graphics format
     */
    PNG("89504E470D0A1A0A", "png"),

    /**
     * Java class file, Mach-O Fat Binary
     */
    JAVA_CLASS("CAFEBABE", "class"),

    /**
     * PostScript document
     */
    PS("25215053", "ps"),

    /**
     * PDF document
     */
    PDF("25504446", "pdf"),

    /**
     * <a href="https://en.wikipedia.org/wiki/Advanced_Systems_Format" title="Advanced Systems
     * Format">Advanced Systems Format</a>
     */
    Windows_Media_Audio("3026B2758E66CF11A6D900AA0062CE6C", "asf", "wma", "wmv"),

    /**
     * Ogg, an open source media container format
     */
    OGG("4F676753", "ogg", "oga", "ogv"),

    /**
     * Photoshop Document file, Adobe Photoshop's native file format
     */
    PSD("38425053", "psd"),

    /**
     * <a href="https://en.wikipedia.org/wiki/Waveform_Audio_File_Format" class="mw-redirect" title=
     * "Waveform Audio File Format">Waveform Audio File Format</a>
     */
    WAV("52494646nnnnnnnn57415645", "wav"),

    /**
     * <a href="https://en.wikipedia.org/wiki/Audio_Video_Interleave" title="Audio Video
     * Interleave">Audio Video Interleave</a> video format
     */
    AVI("52494646nnnnnnnn41564920", "avi"),

    /**
     * <a href="https://en.wikipedia.org/wiki/MPEG-1_Layer_3" class="mw-redirect" title="MPEG-1
     * Layer 3">MPEG-1 Layer 3</a> file without an
     * <a href="https://en.wikipedia.org/wiki/ID3" title="ID3">ID3</a> tag or with an
     * <a href="https://en.wikipedia.org/wiki/ID3" title="ID3">ID3v</a>1 tag (which's appended at
     * the end of the file)
     */
    MP3_1("FFFB", "mp3"),
    /**
     * <a href="https://en.wikipedia.org/wiki/MP3" title="MP3">MP3</a> file with an ID3v2 container
     */
    MP3_2("494433", "mp3"),

    /**
     * <a href="https://en.wikipedia.org/wiki/BMP_file_format" title="BMP file format">BMP</a> file,
     * a <a href="https://en.wikipedia.org/wiki/Bitmap" title="Bitmap">bitmap</a> format used mostly
     * in the <a href="https://en.wikipedia.org/wiki/Windows" class="mw-redirect" title=
     * "Windows">Windows</a> world
     */
    BMP("424D", "bmp", "dib"),

    /**
     * <td><a href="https://en.wikipedia.org/wiki/ISO9660" class="mw-redirect" title=
     * "ISO9660">ISO9660</a> CD/DVD image
     * file<sup id="cite_ref-11" class="reference"><a href="#cite_note-11">[11]</a></sup></td>
     */
    ISO("4344303031", "iso"),

    /**
     * <a href="https://en.wikipedia.org/wiki/Compound_File_Binary_Format" title="Compound File
     * Binary Format">Compound File Binary Format</a>, a container format used for document by older
     * versions of
     * <a href="https://en.wikipedia.org/wiki/Compound_File_Binary_Format" title="Microsoft
     * Office">Microsoft
     * Office</a>.<sup id="cite_ref-15" class="reference"><a href="#cite_note-15">[15]</a></sup> It
     * is however an open format used by other programs as well.
     */
    Microsoft_Office("D0CF11E0A1B11AE1", "doc", "xls", "ppt", "msg"),

    /**
     * <a href="https://en.wikipedia.org/wiki/Dalvik_(software)" title="Dalvik
     * (software)">Dalvik</a> Executable
     */
    DEX("6465780A30333500", "dex"),

    /**
     * VMDK files : http://www.vmware.com/app/vmdk/?src=vmdk
     */
    VMDK("4B444D", "vmdk"),

    /**
     * <a href="https://en.wikipedia.org/wiki/Apple_Disk_Image" title="Apple Disk Image">Apple Disk
     * Image</a> file
     */
    DMG("7801730D626260", "dmg"),

    /**
     * <a href="https://en.wikipedia.org/wiki/Xar_(archiver)" title="Xar (archiver)">eXtensible
     * ARchive</a>
     * format<sup id="cite_ref-23" class="reference"><a href="#cite_note-23">[23]</a></sup>
     */
    XAR("78617221", "xar"),

    /**
     * Windows Files And Settings Transfer
     * Repository<sup id="cite_ref-24" class="reference"><a href="#cite_note-24">[24]</a></sup>
     * <p>
     * See also USMT 3.0 (Win
     * XP)<sup id="cite_ref-25" class="reference"><a href="#cite_note-25">[25]</a></sup> and USMT
     * 4.0 (Win 7)<sup id="cite_ref-26" class="reference"><a href="#cite_note-26">[26]</a></sup>
     * User Guides
     * </p>
     */
    DAT("504D4F43434D4F43", "dat"),

    /**
     * <a href="https://en.wikipedia.org/wiki/Tar_(computing)" title="Tar (computing)">tar
     * archive</a>
     */
    TAR_1("7573746172003030", "tar"),
    /**
     * <a href="https://en.wikipedia.org/wiki/Tar_(computing)" title="Tar (computing)">tar
     * archive</a>
     */
    TAR_2("7573746172202000", "tar"),

    /**
     * 7-Zip File Format
     */
    _7Z("377ABCAF271C", "7z"),

    /**
     * <a rel="nofollow" class="external text" href="https://tools.ietf.org/html/rfc1952">GZIP</a>
     */
    TAR_GZ("1F8B", "gz", "tar.gz", "tgz"),

    /**
     * <a href="https://en.wikipedia.org/wiki/LZ4_(compression_algorithm)" title="LZ4 (compression
     * algorithm)">LZ4 Streaming
     * Format</a><sup id="cite_ref-32" class="reference"><a href="#cite_note-32">[32]</a></sup><br>
     * <p>
     * Remark: LZ4 compressed data (file) format does not offer any magic
     * bytes.<sup id="cite_ref-33" class="reference"><a href="#cite_note-33">[33]</a></sup>
     * </p>
     */
    LZ4("04224D18", "lz4"),

    /**
     * Microsoft Cabinet file
     */
    CAB("4D534346", "cab"),

    /**
     * <a href="https://en.wikipedia.org/wiki/Free_Lossless_Image_Format" title="Free Lossless Image
     * Format">Free Lossless Image Format</a>
     */
    FLIF("464C4946", "flif"),

    /**
     * <a href="https://en.wikipedia.org/wiki/Matroska" title="Matroska">Matroska</a> media
     * container, including <a href="https://en.wikipedia.org/wiki/WebM" title="WebM">WebM</a>
     */
    MKV("1A45DFA3", "mkv", "mka", "mks", "mk3d", "webm"),

    /**
     * DER encoded X.509 certificate
     */
    DER("3082", "der"),

    /**
     * CAD
     */
    DWG("41433130"),

    /**
     * XML
     */
    XML("3C3F786D6C", "xml"),

    /**
     * HTML
     */
    HTML("3C21444F43545950452068746D6C", "html"); // 68746D6C3E

    /**
     * File Magic number
     */
    private String value;

    /**
     * 文件扩展名
     */
    private String[] fileExtension;

    private FileType(String value, String... fileExtension) {
        this.value = value;
        this.fileExtension = fileExtension;
    }

    /**
     * File Magic number
     */
    public String getValue() {
        return value;
    }

    /**
     * File Magic number
     */
    public void setValue(String value) {
        this.value = value;
    }

    /**
     * 文件扩展名
     */
    public String[] getFileExtension() {
        return fileExtension;
    }

    /**
     * 文件扩展名
     */
    public void setFileExtension(String[] fileExtension) {
        this.fileExtension = fileExtension;
    }

}
